Skip to content

fix: visualizer getCSV method throwing constant errors#1263

Merged
HardeepAsrani merged 3 commits intodevelopmentfrom
fix/issue-400
Mar 10, 2026
Merged

fix: visualizer getCSV method throwing constant errors#1263
HardeepAsrani merged 3 commits intodevelopmentfrom
fix/issue-400

Conversation

@HardeepAsrani
Copy link
Member

Summary

Adds safeguards to prevent the _getCSV from throwing constant errors.

Will affect visual aspect of the product

YES/NO

Screenshots

Test instructions

  • Not sure how we can test, we have just added safe guards to prevent it from happening.

Check before Pull Request is ready:

Closes https://github.com/Codeinwp/visualizer-pro/issues/400.

@HardeepAsrani HardeepAsrani requested a review from Copilot March 5, 2026 22:19
@pirate-bot pirate-bot added the pr-checklist-complete The Pull Request checklist is complete. (automatic label) label Mar 5, 2026
@pirate-bot
Copy link
Contributor

pirate-bot commented Mar 5, 2026

Plugin build for 4825cc2 is ready 🛎️!

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to stop Visualizer’s CSV export (_getCSV) from repeatedly triggering runtime errors by adding additional safeguards around temporary file creation, and updates the test suite/tooling to support newer PHPUnit behavior.

Changes:

  • Add a fallback/early-return guard in Visualizer_Module::_getCSV() when a writable temp file handle can’t be created.
  • Refactor/export tests to reuse a helper for running the export AJAX action and add CSV response-structure assertions.
  • Add Yoast PHPUnit Polyfills (and bootstrap loading) to improve PHPUnit cross-version compatibility; update composer.lock accordingly.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
classes/Visualizer/Module.php Adds additional guard(s) when temp file creation fails during CSV generation.
tests/test-export.php Adds a helper to run export AJAX, adds CSV structure test, adjusts invalid-chart expectations.
tests/test-ajax.php Replaces deprecated PHPUnit assertions with property_exists() checks.
tests/bootstrap.php Loads Yoast PHPUnit Polyfills autoloader early in the test bootstrap.
composer.json Adds yoast/phpunit-polyfills to require-dev.
composer.lock Locks new dev dependencies brought in by PHPUnit polyfills/tooling changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@Soare-Robert-Daniel Soare-Robert-Daniel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Copilot made some great points on the review.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@HardeepAsrani HardeepAsrani merged commit 5e9cea6 into development Mar 10, 2026
11 of 12 checks passed
@HardeepAsrani HardeepAsrani deleted the fix/issue-400 branch March 10, 2026 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-checklist-complete The Pull Request checklist is complete. (automatic label)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants